<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"
	xmlns:p="http://primefaces.prime.com.tr/ui">



<head>
<title>Rota Estatisctica - Cadastro de Usuário</title>

</head>

<body>

	<h3>Preencha o formulário a seguir</h3>

	<h:form>

		<rich:messages globalOnly="true" infoStyle="color:blue" warnStyle="color:orange" errorStyle="color:red" fatalStyle="color:red"></rich:messages>

		<h:panelGrid columns="2">

			<h:outputText value="Nome"></h:outputText>
			<h:panelGroup>
				<a4j:region renderRegionOnly="true">
					<h:inputText id="nome" value="#{cadastroUsuarioView.nome}" required="true" requiredMessage="Campo Obrigatório">
						<a4j:support event="onblur"></a4j:support>
					</h:inputText>
					<rich:message for="nome" style="color:red" />
				</a4j:region>
			</h:panelGroup>

			<h:outputText value="Data de Nascimento"></h:outputText>
			<h:panelGroup>
				<a4j:region renderRegionOnly="true">
					<a4j:outputPanel id="dataDeNascimento" layout="block">
						<rich:calendar value="#{cadastroUsuarioView.dataDeNascimento}" locale="BR" popup="true" datePattern="dd/MM/yyyy" showApplyButton="true"
							cellWidth="24px" cellHeight="22px" style="width:200px" required="true" requiredMessage="Campo Obrigatório">
							<a4j:support event="onblur"></a4j:support>
						</rich:calendar>
					</a4j:outputPanel>
					<rich:message for="dataDeNascimento" style="color:red" />
				</a4j:region>
			</h:panelGroup>

			<h:outputText value="Sexo"></h:outputText>
			<h:panelGroup>
				<a4j:region renderRegionOnly="true">
					<h:selectOneRadio id="sexo" value="#{cadastroUsuarioView.sexo}" required="true" requiredMessage="Campo Obrigatório">
						<f:selectItem itemValue="M" itemLabel="Masculino"></f:selectItem>
						<f:selectItem itemValue="F" itemLabel="Feminino"></f:selectItem>
						<a4j:support event="onblur"></a4j:support>
					</h:selectOneRadio>
					<rich:message for="sexo" style="color:red" />
				</a4j:region>
			</h:panelGroup>

			<h:outputText value="E-mail"></h:outputText>
			<h:panelGroup>
				<a4j:region renderRegionOnly="true">
					<h:inputText id="email" value="#{cadastroUsuarioView.email}" required="true" requiredMessage="Campo Obrigatório">
						<a4j:support event="onblur"></a4j:support>
					</h:inputText>
					<rich:message for="email" style="color:red" />
				</a4j:region>
			</h:panelGroup>

			<h:outputText value="Telefone"></h:outputText>
			<h:panelGroup>
				<a4j:region renderRegionOnly="true">
					<h:inputText id="telefone" value="#{cadastroUsuarioView.telefone}" required="true" requiredMessage="Campo Obrigatório" converterMessage="Informe apenas numeros">
						<a4j:support event="onblur"></a4j:support>
					</h:inputText>
					<rich:message for="telefone" style="color:red" />
				</a4j:region>
			</h:panelGroup>

			<h:outputText value="Escolha uma senha"></h:outputText>
			<h:panelGroup>
				<a4j:region renderRegionOnly="true">
					<h:inputSecret id="senha" value="#{cadastroUsuarioView.senha}" required="true" requiredMessage="Campo Obrigatório">
						<a4j:support event="onblur"></a4j:support>
					</h:inputSecret>
					<rich:message for="senha" style="color:red" />
				</a4j:region>
			</h:panelGroup>
		</h:panelGrid>

		<h:panelGrid columns="1">
			<h:commandButton value="Enviar" action="#{cadastroUsuarioView.cadastrarUsuario}"></h:commandButton>
		</h:panelGrid>
	</h:form>

</body>
</html>